const bcrypt = require('bcryptjs') // 密码加密

const { userFormateError } = require('../constant/err.type')

const userValidator = async (ctx, next) => {
  const { username, password } = ctx.request.body
  if (!username || !password) {
    console.error('用户名或密码为空', ctx.request.body)
    ctx.app.emit('error', userFormateError, ctx)
    return

  }
  await next()
}

module.exports = {
  userValidator
}